{% extends "../../_basic.twig" %}

{% block header %}
    <script src="../../../src/aux-date/index.js?v={{random()}}"></script>
    <link rel="stylesheet" href="../../../src/aux-date/index.css?v={{random()}}">
{% endblock %}

{% block body %}
    <div>      
        <div>date</div>
        <div><aux-date id="date" value="1520469682541" format="Y-m-d h:i:s"></aux-date></div>
        <button id="set">设置为当前时间通过attribute</button>
        <script>
            document.getElementById("set").addEventListener("click", function() {
                document.getElementById("date").setAttribute("value", Date.now());
                {# document.getElementById("date").value = new Date(); #}
            });
        </script>
        <button id="for">设置为当前时间通过format</button>
        <script>
            document.getElementById("for").addEventListener("click", function() {
                document.getElementById("date").setAttribute("format", "Y/m/d h:i:s");
            });
        </script>
    </div>
{% endblock %}
